home *** CD-ROM | disk | FTP | other *** search
- Path: news.infinet.com!usenet
- From: Paul Swetnam <pswetnam@infinet.com>
- Newsgroups: comp.sys.m68k
- Subject: Re: Bus Error Handler for 68040
- Date: Fri, 02 Feb 1996 08:50:37 -0800
- Organization: Aeroflex Lintek Corp.
- Message-ID: <311240DD.7A42@infinet.com>
- References: <30FFE81F.4110@infinet.com> <823212746.11237@fpfnet.demon.co.uk>
- NNTP-Posting-Host: cmh-p095.infinet.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b6b (Win16; I)
-
- Thanks to everyone's help. I've received some private email along with
- the newsgroup posts, so I wanted to post a follow up message describing
- my solution for all to see.
-
- (Sorry this message is in such a funny place, my news server has already
- dropped the main message thread and left me with only a few response
- threads on which to post)
-
- It turns out that by following each instruction which may cause a bus
- error with a NOP, we can reliably process, log bus errors, and continue
- code execution. The RTE instruction at the end of our bus error handler
- always begins execution at the NOP following the instruction which caused
- the bus error. We have written two functions hrd_vWriteWord() and
- hrd_usReadWord() which have the NOP instruction built in. All VME bus
- writes (the instructions which may cause bus errors) are routed through
- these functions.
-
- Ludis Langens provided me with an explanation:
-
- > The 68040 has a different way of handling bus errors than earlier 68k
- > family members. The 68010/020/030 use instruction continuation - in
- > other words they save all internal state information so that upon the
- > RTE the instruction can resume where it stopped. This allows your
- > bus error handler to 'emulate' the missing memory. The 68040 uses
- > instruction restart - internal registers are restored to the values
- > they held at the start of the instruction so that the RTE can run
- > the instruction over again. The only time it won't do the instruction
- > over again is if it has already completed internally and just needs
- > a final write back. The restart model makes emulation of missing
- > memory impossible unless you are willing to use a software emulation
- > of the complete instruction. (For some instructions it is possible to
- > use an MMU trick but for others (like CMP (A0)+,(A0)+) this is not
- > possible.)
-
- > I suspect that your use of NOPs seems to fix the problem because it
- > ensures that the following instruction (the NOP) does not cause a
- > bus error until the previous instruction has reached the write back
- > stage. Alternately, perhaps the 68040 uses restart if a bus error
- > occurs if any instruction is partly executed (the faulting write OR
- > the following instruction.) In this case the NOP keeps the execution
- > unit between instructions because it won't start until the bus is idle.
-
- I have the source code from our solution if anyone is interested.
-
- Will Koehler
- Design Engineer
- Aeroflex Lintek Corp.
-
-
-